<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- $Id: compiling.html,v 1.16 2002/03/09 21:14:15 wcc Exp $ -->

<html>
  <head>
    <title>Eggdrop Documentation: Compiling FAQ</title>
  </head>

  <body>
    <div align="center">
      <p><strong>Compiling FAQ</strong></p>
    </div>
    <hr>

    <p>This FAQ may help you successfully compile Eggdrop. Suggestions
    are by various contributors. If you think something should be added,
    please send an e-mail to <a href="mailto:eggheads@eggheads.org">
    eggheads@eggheads.org</a>.</p>

    <p>Last revised: February 25, 2002</p>
    <hr>

    <p><a href="#egg">Eggdrop Related Questions</a></p>

    <blockquote>
      <ol>
        <li><a href="#egg1">Undefined references in net.o (Sun OS)</a></li>

        <li><a href="#egg2">Compile stops at the last minute with &quot;ld
        fatal signal 11&quot;! (Linux)</a></li>

        <li><a href="#egg3">ld: -ltcl7.4: Expected libx.so(.major.minor.xxx)
        (various)</a></li>

        <li><a href="#egg4">Strip terminated with signal 6 (various)</a></li>

        <li><a href="#egg5">&#39;dir&#39; undeclared (and a whole bunch of
        others) (AIX 4)</a></li>

        <li><a href="#egg6">&#39;fd_set&#39; undeclared (and a whole bunch of
        others) (AIX 4)</a></li>

        <li><a href="#egg7">Unresolved or undefined symbols: ldclose, ldopen,
        ldnshread (AIX 3)</a></li>

        <li><a href="#egg8">Unsatisfied symbols &#39;shl_findsym&#39; and
        &#39;shl_load&#39; (HP-UX 9)</a></li>

        <li><a href="#egg9">Bot doesn&#39;t compile on Ultrix</a></li>

        <li><a href="#egg10">Bot crashes at startup with the message
        "net.c/708", for example</a></li>

        <li><a href="#egg11">I get lot&#39;s of warnings</a></li>
      </ol>
    </blockquote>

    <p><a href="#tcl">Tcl Related Questions</a></p>

    <blockquote>
      <ol>
        <li><a href="#tcl1">Redeclaration in compat/unistd.h (Tcl 7.4/AIX
        4)</a></li>

        <li><a href="#tcl2">Conflicting types for &#39;waitpid&#39; (Tcl
        7.5/SunOS 5.4)</a></li>

        <li><a href="#tcl3">Undefined symbols in tclUnixChan.o -- and many
        others (Tcl 7.5/SunOS 5.4)</a></li>

        <li><a href="#tcl4">Undefined symbol &#39;getwd&#39; in getcwd.o (Tcl
        7.5/SunOS 5.4)</a></li>

        <li><a href="#tcl5">There&#39;s no Tcl installed on your
        shell</a></li>
      </ol>
    </blockquote>
    <hr>

    <p><a name="egg"><strong>Eggdrop related questions</strong></a></p>

    <p><a name="egg1">1. <strong>Undefined references in net.o (Sun
    OS)</strong></a></p>

    <blockquote>
<pre>
                     First
      Undefined    Referenced
       Symbol       In file

     socket          net.o
     gethostbyname   net.o
     accept          net.o
     bind            net.o
     setsockopt      net.o
     gethostbyaddr   net.o
     getsockname     net.o
     gethostname     net.o
     listen          net.o
     connect         net.o
     ld: fatal: Symbol referencing errors. No output written to eggdrop
</pre>
    </blockquote>

         <p>This seems to be caused by a few libraries not being detected by the
         auto-configure script; it is relatively easy to fix. Edit your Makefile.
         Note that yours may be slightly different than this one when it comes to
         the Tcl library, but here is the way it probably is:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS= -L/usr/local/lib -ltcl -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=:&#39; &#39;STRIP=&#39;
</pre>
    </blockquote>

    <p>Here is what you need to change it to:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS=-lsocket -ldl -lnsl -L/usr/local/lib -ltcl -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=:&#39; &#39;STRIP=&#39;
</pre>
    </blockquote>

    <p>You are adding three libraries to be linked in: socket, dl, and
    nsl. This will resolve the net.o errors.</p>

    <p><a name="egg2">2. <strong>Compile stops at the last minute with
    &quot;ld fatal signal 11&quot;! (Linux)</strong></a></p>

    <p>This seems to be caused by a non-ELF Tcl library binary, and the
    compiler doesn&#39;t seem to like it. The first thing you want to do is
    download and compile Tcl yourself. Then, follow this set of commands
    to help you reconfigure Eggdrop using the newly compiled Tcl library (all
    of this should be done from your home directory):</p>

    <blockquote>
      <ol>
         <li>cd</li>
         <li>mkdir lib</li>
         <li>mkdir include</li>
         <li>find . -name libtcl*</li>
       </ol>
    </blockquote>

    <p>The output from the find command should give you the location of the
    library. Take the output of that and do the next command with the output
    of find replacing $$find$$:</p>

    <blockquote>
      <p>mv $$find$$ lib/libtcl.a</p>
    </blockquote>

    <p>Now, we continue with another find to help us locate tcl.h:</p>

    <blockquote>
      <p>find . -name tcl.h</p>
    </blockquote>

    <p>The output from the find command should give you the location of the
    header file. Take the output of that, and do the next command with the
    output of find replacing $$find$$:</p>

    <blockquote>
      <p>mv $$find$$ include</p>
    </blockquote>

    <p>Hopefully, you know what shell you are using and can pick out which
    commands to use. If the first two setenv commands give a &#39;command not
    found&#39; error, then use the next two. If not, then don&#39;t use the next
    two. The first set of commands is for csh/tcsh users; the next set is for
    bash/ksh users.</p>

    <blockquote>
      <dl>
        <dt>csh/tcsh:</dt>

        <dd>
          <p>setenv TCLLIB &#39;$HOME/lib&#39;<br>
           setenv TCLINC &#39;$HOME/include&#39;</p>
        </dd>

        <dt>bash/ksh:</dt>

        <dd>
          <p>export TCLLIB=&#39;$HOME/lib&#39;<br>
           export TCLINC=&#39;$HOME/include&#39;</p>
        </dd>
      </dl>
    </blockquote>

    <p>Finally, run ./configure again, then make, and hopefully it will
    work.</p>

    <p><a name="egg3">3. <strong>ld: -ltcl7.4: Expected
    libx.so(.major.minor.xxx) (various)</strong></a></p>

    <blockquote>
<pre>
        ld: -ltcl7.4: expected libx.so(.major.minor.xxx)
        collect2: ld returned 4 exit status
        *** Error code 1
        make: Fatal error: Command failed for target `eggdrop&#39;
</pre>
    </blockquote>

    <p>On some Unix boxes, this seems to be caused by the linker. It is
    expecting a specific filename format, and when the filename doesn&#39;t
    live up to it&#39;s expectations, it usually barfs. I always see this when
    the library for Tcl is called libtcl7.4.a or libtcl7.5.a. Rename it to
    libtcl.a if you installed Tcl yourself; if you didn&#39;t and your using
    the Tcl that the system admin installed, then do this:</p>

    <p>View your Makefile, look for the line (should be close to the top)
    that says:</p>

    <blockquote>
      <p>XREQ = /usr/local/lib/libtcl7.4.a</p>
    </blockquote>

    <p>And remember that FULL pathname. Go to your home directory, and do the
    following:</p>

    <blockquote>
       <ol>
         <li>mkdir lib</li>
         <li>cd lib</li>
         <li>ln -s $$xreq$$ libtcl.a</li>
       </ol>
    </blockquote>

    <p>Replace $$xreq$$ with the full pathname from the XREQ line in the
    Makefile.</p>

    <p>The next thing you want to do, depending on what shell your using,
    is (if the first two setenv commands give a &#39;command not found&#39;
    error, then use the next two.):</p>

    <blockquote>
      <dl>
        <dt>csh/tcsh:</dt>

        <dd>
          <p>setenv TCLLIB &#39;$HOME/lib&#39;</p>
        </dd>

        <dt>bash/ksh:</dt>

        <dd>
          <p>export TCLLIB=&#39;$HOME/lib&#39;</p>
        </dd>
      </dl>
    </blockquote>

    <p>Finally, run ./configure and then make again.</p>

    <p><a name="egg4">4. <strong>Strip terminated with signal 6</strong></a>
    </p>

    <blockquote>
<pre>
        collect2: strip terminated with signal 6 [IOT/Abort trap]
        *** Exit 1
        Stop.
        *** Exit 1
        Stop.
</pre>
    </blockquote>

    <p>I don&#39;t really know what the hell is causing this, but I find that
    if you don&#39;t strip the binary, you cut out the problem (obviously).
    Edit your Makefile, and change this line from:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS= -L/usr/local/lib -ltcl -lm&#39; \
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=ranlib&#39; &#39;STRIP=-s&#39;
</pre>
    </blockquote>

    <p>To (your lines may differ, but what you are doing is
     changing &#39;STRIP=-s&#39; to &#39;STRIP=&#39;):</p>
    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS= -L/usr/local/lib -ltcl -lm&#39; \
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=ranlib&#39; &#39;STRIP=&#39;
</pre>
    </blockquote>

    <p><a name="egg5">5. <strong>&#39;dir&#39; undeclared (and a whole bunch
    of others) (AIX 4)</strong></a></p>

    <blockquote>
<pre>
        gcc -c -O2 -fno-strength-reduce -I.. -DHAVE_CONFIG_H  filedb.c
        filedb.c: In function `filedb_update&#39;:
        filedb.c:209: `DIR&#39; undeclared (first use this function)
        filedb.c:209: (Each undeclared identifier is reported only once
        filedb.c:209: for each function it appears in.)
        filedb.c:209: `dir&#39; undeclared (first use this function)
        filedb.c:209: parse error before `*&#39;
        filedb.c:217: warning: assignment makes pointer from integer without a cast
        filedb.c:218: `name&#39; undeclared (first use this function)
        filedb.c:218: dereferencing pointer to incomplete type
        filedb.c:220: dereferencing pointer to incomplete type
        filedb.c:220: dereferencing pointer to incomplete type
        filedb.c:224: dereferencing pointer to incomplete type
        filedb.c:224: dereferencing pointer to incomplete type
        filedb.c:225: dereferencing pointer to incomplete type
        filedb.c:230: `s&#39; undeclared (first use this function)
        filedb.c:231: `st&#39; undeclared (first use this function)
        filedb.c:232: `fdb&#39; undeclared (first use this function)
        filedb.c:232: `where&#39; undeclared (first use this function)
        filedb.c:237: `fdb1&#39; undeclared (first use this function)
        filedb.c:253: warning: assignment makes pointer from integer without a cast
        make: The error code from the last command is 1.
</pre>
    </blockquote>

    <p>This seems like one of the components of configure was broken, because
    what apparently happened was it didn&#39;t detect that this particular
    system had dirent.h and sys/dir.h. The solution is to add -DHAVE_DIRENT_H
    -DHAVE_SYS_DIR_H to the Makefile&#39;s CFLGS line:</p>

    <blockquote>
      <p>CFLGS = -DHAVE_DIRENT_H -DHAVE_SYS_DIR_H</p>
    </blockquote>

    <p><a name="egg6">6. <strong>&#39;fd_set&#39; undeclared (and a whole
    bunch of others) (AIX 4)</strong></a></p>

    <blockquote>
<pre>
        gcc -c -O2 -fno-strength-reduce -I.. -DHAVE_CONFIG_H -DHAVE_DIRENT_H -DHAVE_SYS_DIR_H net.c
        net.c: In function `sockread&#39;:
        net.c:390: `fd_set&#39; undeclared (first use this function)
        net.c:390: (Each undeclared identifier is reported only once
        net.c:390: for each function it appears in.)
        net.c:390: parse error before `fd&#39;
        net.c:396: `fd&#39; undeclared (first use this function)
        make: The error code from the last command is 1.
</pre>
    </blockquote>

    <p>Again, this seems that one of configure&#39;s components (sed, awk, or
    something along those lines) was broken, and it failed to detect that
    this system needed sys/select.h. The solution is to add -DHAVE_SYS_SELECT_H
    to the Makefile&#39;s CFLGS line:</p>

    <blockquote>
      <p>CFLGS = -DHAVE_DIRENT_H -DHAVE_SYS_DIR_H -DHAVE_SYS_SELECT_H</p>
    </blockquote>

    <p>I suppose they thought a minor error would deter anyone from
     continuing onward, but I am not just anyone, I am a blockhead...
    &lt;grin&gt;</p>

    <p><a name="egg7">7. <strong>Unresolved or undefined symbols: ldclose,
    ldopen, ldnshread (AIX 3)</strong></a></p>

    <blockquote>
<pre>
     cc -s -o eggdrop chan.o chanprog.o chanset.o cmds.o dcc.o dccutil.o
     filedb.o fileq.o files.o gotdcc.o hash.o main.o match.o mem.o misc.o
     mode.o msgcmds.o msgnotice.o net.o tandcmd.o tandem.o tcl.o tclhash.o
     userrec.o users.o -L/home2/f/foster/lib -ltcl7.5 -lm
        0706-317 ERROR: Unresolved or undefined symbols detected:
                         Symbols in error (followed by references) are dumped to the load map.
                         The -bloadmap:&lt;filename&gt; option will create a load map.
        .ldclose
        .ldopen
        .ldnshread
        make: 1254-004 The error code from the last command is 8.
</pre>
    </blockquote>

    <p>Apparently, what is happening is a library called ld is required.
    Either configure doesn&#39;t know it is needed, it simply can&#39;t
    find it, or maybe this is a unique case. The solution is to have ld linked
    in with the final binary.</p>

    <p>Edit your Makefile and find the line that looks something like
    this:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=cc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl7.5.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS= -L/home2/f/foster/lib -ltcl7.5 -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=ranlib&#39; &#39;STRIP=-s&#39;
</pre>
    </blockquote>

    <p>Add in -lld into the XLIBS assignment, like this:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=cc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl7.5.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS=-lld -L/home2/f/foster/lib -ltcl7.5 -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=ranlib&#39; &#39;STRIP=-s&#39;
</pre>
    </blockquote>

    <p><a name="egg8">8. <strong>Unsatisfied symbols &#39;shl_findsym&#39;
    and &#39;shl_load&#39; (HP-UX 9)</strong></a></p>

    <blockquote>
<pre>
        gcc -s -o eggdrop chan.o chanprog.o chanset.o cmds.o dcc.o
     dccutil.o filedb.o fileq.o files.o gotdcc.o hash.o main.o match.o
     mem.o misc.o mode.o msgcmds.o msgnotice.o net.o tandcmd.o tandem.o
     tcl.o tclhash.o userrec.o users.o -L/home/hltran/tcl/lib -lt
     cl7.5 -lm
        /bin/ld: Unsatisfied symbols:
           shl_findsym (code)
           shl_load (code)
        collect2: ld returned 1 exit status
        *** Error code 1
        Stop.
</pre>
    </blockquote>

    <p>Upgrade to a later version of Tcl. The following should also work:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl7.5.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS= -L/usr/local/lib -ltcl7.5 -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=:&#39; &#39;STRIP=&#39;
</pre>
    </blockquote>

    <p>Add in -lld into the XLIBS assignment, like this:</p>

    <blockquote>
<pre>
     GMAKE = ${MAKE} &#39;CC=gcc&#39; &#39;AWK=awk&#39; &#39;OBJS=${OBJS}&#39; &#39;TCLLIBFN=tcl7.5.a&#39;\
             &#39;CFLAGS=${CFLAGS}&#39; &#39;XREQ=${XREQ}&#39; &#39;XLIBS=-ldl -L/usr/local/lib -ltcl7.5 -lm&#39;\
             &#39;TCLLIB=${TCLLIB}&#39; &#39;RANLIB=:&#39; &#39;STRIP=&#39;
</pre>
    </blockquote>

    <p><a name="egg9">9. <strong>Bot doesn&#39;t compile on Ultrix</strong></a></p>

     <p>There are some known problems with make and Eggdrop on Ultrix systems.
     Try to use gmake instead of make. Additionally, sh5 should be used. A
     simple &#39;gmake SHELL=/bin/sh5&#39; should be enough.</p>

    <p><a name="egg10">10. <strong>Bot crashes at startup with the message
    "net.c/708", for example</strong></a></p>

     <p>On some non IA32 systems, the gcc options -O2 and -O3 can cause that. We
     don&#39;t know why this happens, but sometimes it helps to remove those flags
     from the Makefile. To disable them, use:</p>

    <blockquote>
      <p>./configure --disable-cc-optimization</p>
    </blockquote>

     <p>Ah well, drop us a note if you know why, so we can extend the info
     here.</p>

    <p><a name="egg11">11. <strong>I get lot&#39;s of warnings</strong></a></p>

     <p>Well, warnings are warnings, nothing really bad. As long as the compile
     runs through, there is nothing to worry about. Generally, we try to avoid
     warnings, but we do not have time to fix all of them in the code. This
     might change in the future, but at the moment you have to live with them.
     If you feel like fixing them, do so and send us a patch (as described in
     doc/patch.howto). Thanks.</p>

    <p><a name="tcl"><strong>Tcl Related Questions</strong></a></p>

    <p><a name="tcl1">1. <strong>Redeclaration in compat/unistd.h (Tcl
    7.4/AIX 4)</strong></a></p>

    <blockquote>
<pre>
        cc -c -O -I. -I. -DHAVE_________=1 -DSTDC_HEADERS=1
     -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -Dvfork=fork
     -DTCL_LIBRARY=\&quot;/usr/local/lib/tcl7.4\&quot; regexp.c
        &quot;compat/unistd.h&quot;, line 42.12: 1506-343 (S) Redeclaration of execl
     differs from previous declaration on line 121 of
     &quot;/usr/include/unistd.h&quot;.
        &quot;compat/unistd.h&quot;, line 42.12: 1506-378 (I) Prototype for function
     execl cannot contain &quot;...&quot; when mixed with a nonprototype declaration.

        &quot;compat/unistd.h&quot;, line 43.12: 1506-343 (S) Redeclaration of execle
     differs from previous declaration on line 123 of
     &quot;/usr/include/unistd.h&quot;.
        &quot;compat/unistd.h&quot;, line 43.12: 1506-378 (I) Prototype for function
     execle cannot contain &quot;...&quot; when mixed with a nonprototype
     declaration.
        &quot;compat/unistd.h&quot;, line 44.12: 1506-343 (S) Redeclaration of execlp
     differs from previous declaration on line 125 of
     &quot;/usr/include/unistd.h&quot;.
        &quot;compat/unistd.h&quot;, line 44.12: 1506-378 (I) Prototype for function
     execlp cannot contain &quot;...&quot; when mixed with a nonprototype
     declaration.
        make: The error code from the last command is 1.
</pre>
    </blockquote>

    <p>It seems that configure had a brain fart. Would you believe this was
    the same system as in A.6 and A.7? Heh, it was. Apparently, it thought
    this system didn&#39;t have unistd.h, and was using it&#39;s compatible
    header. The solution is to edit Makefile and change this line:</p>

    <blockquote>
      <p>AC_FLAGS = -DHAVE_________=1 -DSTDC_HEADERS=1 -DNO_UNION_WAIT=1
      -DNEED_MATHERR=1 -Dvfork=fork</p>
    </blockquote>

    <p>To the following:</p>

    <blockquote>
      <p>AC_FLAGS = -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DNO_UNION_WAIT=1
      -DNEED_MATHERR=1 -Dvfork=fork</p>
    </blockquote>

    <p><a name="tcl2">2. <strong>Conflicting types for &#39;waitpid&#39; (Tcl
    7.5/SunOS 5.4)</strong></a></p>

    <blockquote>
<pre>
        cc -c -O  -I./../generic -I. -DNO_STRERROR=1 -DNO_GETWD=1
     -DNO_WAIT3=1 -DNO_UNAME=1 -DNO_DIRENT_H=1 -DHAVE_UNISTD_H=1
     -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TIMEZONE_VAR=1
     -DUSE_DIRENT2_H=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -Dvfork=fork -DN
     O_GETTOD=1 -DGETTOD_NOT_DECLARED=1       -DTCL_SHLIB_EXT=\&quot;.so\&quot;
        ./../compat/waitpid.c
        ./../compat/waitpid.c:69: conflicting types for `waitpid&#39;
        /usr/include/sys/wait.h:80: previous declaration of `waitpid&#39;
        make: *** [waitpid.o] Error 1
</pre>
    </blockquote>

    <p>Configure apparently couldn&#39;t figure this one out, probably
    because the system it was configured on sucks badly. Change the following
    line in Makefile:</p>

    <blockquote>
<pre>
     COMPAT_OBJS =          getcwd.o opendir.o strstr.o strtol.o tmpnam.o
     waitpid.o strstr.o strtoul.o strtod.o strncasecmp.o
</pre>
    </blockquote>

    <p>To the following:</p>

    <blockquote>
<pre>
     COMPAT_OBJS =          getcwd.o opendir.o strstr.o strtol.o tmpnam.o
     strstr.o strtoul.o strtod.o strncasecmp.o
</pre>
    </blockquote>

    <p>We are deleting the waitpid.o object file. The problem is that
    configure didn&#39;t detect that waitpid() isn&#39;t necessary, so it
    caused a compatible waitpid() function to be compiled.</p>

    <p><a name="tcl3">3. <strong>Undefined symbols in tclUnixChan.o -- and
    many others (Tcl 7.5/SunOS 5.4)</strong></a></p>

    <blockquote>
<pre>
        gcc  tclAppInit.o -L/export/home/rewt/tcl7.5/unix -ltcl7.5 -ldl -lm -lc \
                 -o tclsh
        Undefined                       First Referenced
         Symbol                             In File

        socket
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        getpeername
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        recv
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        gethostbyname
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        accept
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        send
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        bind
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        setsockopt
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        getwd
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(getcwd.o)
        getservbyname
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclIOSock.o)
        gethostbyaddr
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        getsockopt
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclIOSock.o)
        inet_addr
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        inet_ntoa
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        getsockname
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        listen
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)
        connect
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(tclUnixChan.o)

        ld: fatal: Symbol referencing errors. No output written to tclsh
        make: *** [tclsh] Error 1
</pre>
    </blockquote>

    <p>Configure couldn&#39;t find or detect that the nsl and socket libraries
    were required, so we have to force it to use them. The solution is to edit
    Makefile and change the following line:</p>

    <blockquote>
      <p>LIBS = -ldl</p>
    </blockquote>

    <p>To the following:</p>

    <blockquote>
      <p>LIBS = -ldl -lnsl -lsocket</p>
    </blockquote>

    <p><a name="tcl4">4. <strong>Undefined symbol &#39;getwd&#39; in getcwd.o
    (Tcl 7.5/SunOS 5.4)</strong></a></p>

    <blockquote>
<pre>
        gcc  tclAppInit.o -L/export/home/rewt/tcl7.5/unix -ltcl7.5 -ldl -lnsl -lsocket -lm -lc \
                 -o tclsh
        Undefined                       First Referenced
         Symbol                             In File

        getwd
     /export/home/rewt/tcl7.5/unix/libtcl7.5.a(getcwd.o)

        ld: fatal: Symbol referencing errors. No output written to tclsh
        make: *** [tclsh] Error 1
</pre>
    </blockquote>

    <p>Configure apparently couldn&#39;t figure this one out, probably
    because the system it was configured on sucks badly. Change the following
    line in Makefile:</p>

    <blockquote>
<pre>
     COMPAT_OBJS =          getcwd.o opendir.o strstr.o strtol.o tmpnam.o
     strstr.o strtoul.o strtod.o strncasecmp.o
</pre>
    </blockquote>

    <p>To:</p>

    <blockquote>
<pre>
     COMPAT_OBJS =          opendir.o strstr.o strtol.o tmpnam.o strstr.o
     strtoul.o strtod.o strncasecmp.o
</pre>
    </blockquote>

    <p>We are deleting the getcwd.o object file. The problem was that
    configure didn&#39;t detect that getcwd() wasn&#39;t necessary, so it
    caused a compatible getcwd() function to be compiled.</p>

    <p><a name="tcl5">5. <strong>There&#39;s no Tcl installed on your
    shell</strong></a></p>

    <p>If there&#39;s really no Tcl installed on your shell, you can install
    it temporarily in /tmp or your /home. Get the latest version of Tcl from <a
    href="ftp://ftp.scriptics.com/pub/tcl/"> ftp://ftp.scriptics.com/pub/tcl/</a>
    and follow the installation steps in it&#39;s README file. After you&#39;ve
    installed Tcl, you have to make configure detect Tcl. To achieve this, you
    have to set either environmental variables:</p>

    <blockquote>
      <dl>
        <dt>csh/tcsh:</dt>

        <dd>
          <p>setenv LD_LIBRARY_PATH &#39;/path/to/tcl/lib&#39;<br>
           setenv TCLLIB &#39;/path/to/tcl/lib&#39;<br>
           setenv TCLINC &#39;/path/to/tcl/include&#39;</p>
        </dd>

        <dt>bash/ksh:</dt>

        <dd>
          <p>export LD_LIBRARY_PATH=&#39;/path/to/tcl/lib&#39;<br>
           export TCLLIB=&#39;/path/to/tcl/lib&#39;<br>
           export TCLINC=&#39;/path/to/tcl/include&#39;</p>
        </dd>
      </dl>

      <p>./configure --with-tcllib=&#39;/path/to/libtclx.x.so&#39;
      --with-tclinc=&#39;/path/to/tcl.h&#39;</p>
    </blockquote>
    <hr>

    <p><em>Copyright &copy; 1997 Robey Pointer<br>
     Copyright &copy; 1999, 2000, 2001, 2002 <a href="http://www.eggheads.org/">
     Eggheads Development Team</a></em></p>
  </body>
</html>
